<template>
    <h1>这是一个product页面</h1>
</template>

<script>
export default{
    watch:{
        $route(newVal, oldVal){
            console.log('newVal',newVal);
            console.log('oldVal',oldVal);
            this.init
        }
    },
    methods:{
        init(){
            console.log("初始化数据，请求后台数据");
        }
    },
    mounted(){
        this.init();
        console.log("组件的生命周期触发了");
        console.log(this.$route);
    },
}
</script>